{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 测试折叠比例轴"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "\n",
    "import tvm\n",
    "from tvm import te\n",
    "from tvm import relay\n",
    "from tvm.relay import transform\n",
    "from tvm.relay.testing import create_workload\n",
    "from tvm.relay.build_module import bind_params_by_name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "def initializer(_, param):\n",
    "    param = np.zeros(param.shape)\n",
    "\n",
    "\n",
    "def _get_positive_scale(size):\n",
    "    return np.random.uniform(0.5, 1, size=size).astype(\"float32\")\n",
    "\n",
    "\n",
    "def run_opt_pass(expr, opt_pass):\n",
    "    assert isinstance(opt_pass, tvm.transform.Pass)\n",
    "    mod = tvm.IRModule.from_expr(expr)\n",
    "    mod = opt_pass(mod)\n",
    "    entry = mod[\"main\"]\n",
    "    return entry if isinstance(expr, relay.Function) else entry.body"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ai",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
